<?php
if(DEBUG){
?>
</div>
<div>
<div style="margin:0px;width:99%">
    <table cellpadding="0" cellspacing="0" style="float:left;" width="100%">
        <tr>
            <td>
            	<center>
	            	<hr>
	                    Num query: <?=DB::num_queries()?>
    		</center>
    </td>
    </tr>
    </table>
</div>
<?
	
	global $start_rb;
	$mtime 			= microtime();
	$mtime 			= explode(" ",$mtime);
	$mtime 			= $mtime[1] + $mtime[0];
	$end_rb 		= $mtime;
	$page_load_time = round(($end_rb - $start_rb),5)."s";
	
	$time_now 	= date('H:i:s - d-m-Y', TIME_NOW);
	$html_debug 	= CGlobal::$query_debug;
	$queries_count 	= DB::num_queries();
	$queries_time 	= CGlobal::$query_time;
	$conn_debug 	= CGlobal::$conn_debug;

	$sql_load_time = round($queries_time,5) ."s";

	echo "<center><div align=\"left\" style=\"clear:left;width:950px;border:1px red solid;padding-left:30px;padding-bottom:30px;overflow: auto;\">";
	echo "<div style='text-align:center'><span style='color:#444;'>Pageload time : $page_load_time</span></div>";
	echo "<html><head><title>SQL Debugger</title><body bgcolor='white'>";
	echo "<h1 align='center'>SQL Total Time: {$sql_load_time} for {$queries_count} queries</h1>";
	echo "<div style='text-align:center'><span style='color:#666;'>$conn_debug</span></div>";
	echo "<br>{$html_debug}";

	echo "<br /><div align='center'><strong>Pageload time: <span style='color:red'>{$page_load_time}</span> - Total SQL Time: <span style='color:red'>{$sql_load_time}</span> - Total queries : <span style='color:red'>{$queries_count}</span> -  Server IP address : <span style='color:red'>{$_SERVER['SERVER_ADDR']}</span> - Time now is : <span style='color:red'>{$time_now}</span></strong></div></body></html>";

	if(CGlobal::$error_handle){
		echo "<table width='95%' border='1' cellpadding='6' cellspacing='0' bgcolor='#FEFEFE'  align='center'>
		<tr><td style='font-size:14px' bgcolor='#EFEFEF'  align='center'>Enbac Error handle</td></tr>
		".CGlobal::$error_handle."
		</table><br />\n\n";
	}

	echo "</div>
	</center>";
	//All error here
}
?>
</div>


</body>
</html>